home *** CD-ROM | disk | FTP | other *** search
/ Compendium Deluxe 1 / LSD Compendium Deluxe 1.iso / a / programming / assembly / aed_who.lha / aed_who.s < prev    next >
Encoding:
Text File  |  1994-01-03  |  9.9 KB  |  443 lines

  1. *******************************************************************************
  2. * Ami-Express /X3.xx SuperWho               Copyright © 1993 2-Cool/LSd!
  3. * ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
  4. * $Release    : 0.1 $
  5. * $Revision    : 1.03 $
  6. * $Date        : 13-Nov-93 $
  7. *
  8. * $Authors    : Written by 2-Cool/LSd!
  9. *        : Developed using the "AEDoor library".
  10. *
  11. * $Purpose    : An Ami-Express replacement for the INTERNAL 'WHO' door
  12. *        : This one assembles to little over 2k!
  13. *******************************************************************************
  14. ;-------------- Definition Includes
  15.  
  16.         incdir    "includes:"
  17.         include    "exec/exec.i"
  18.         include    "exec/exec_lib.i"
  19.         include    "libraries/dos.i"
  20.         include    "libraries/dos_lib.i"
  21.         include    "amix/amix.i"
  22.         include    "amix/aedoor.i"
  23.  
  24. CALL        macro
  25.         jsr    _LVO\1(a6)
  26.         endm
  27.  
  28.         section    SuperWho,code        ;public memory
  29.  
  30. Startup:    lea    Startup(pc),a5        ;a5=PC-Offsetting Base
  31.         move.b    (a0),d7            ;d7=NODE number (from CLIParam)
  32.  
  33. ;-------------- open AEDoor library
  34.  
  35.         move.l    4.w,a6            ;get execbase
  36.         lea    AEName(pc),a1        ;ptr to name of library to open
  37.         CALL    OldOpenLibrary        ;open the AEDoor Library
  38.         move.l    d0,_AEDBase-Startup(a5)    ;save AEDBase for later use
  39.         beq.w    ExitDoor        ;if fails to open exitfast...
  40.  
  41. ;-------------- open DOS Library
  42.  
  43.         move.l    4.w,a6            ;ge execbase
  44.         lea    DName(pc),a1        ;ptr to name of library to open
  45.         CALL    OldOpenLibrary        ;open the DOS Library
  46.         move.l    d0,_DOSBase-Startup(a5)    ;save DOSBase for later use
  47.         beq.w    CloseAEDoor        ;if fails close all & exit...
  48.  
  49. ;-------------- Create Ami-Door Communication Channel
  50.  
  51.         move.b    d7,d0            ;Get Node Number
  52.         move.l    _AEDBase(pc),a6        ;put AEDBase in a6
  53.         CALL    CreateComm        ;Create our communications port
  54.         move.l    d0,DIFPtr-Startup(a5)    ;save DoorInterface struct ptr
  55.         beq.w    CloseDOS        ;if fails close all & exit...
  56.  
  57. ;-------------- Show 'who' text
  58.  
  59.         lea    Who.txt(pc),a0        ;a0=string
  60.         move.l    DIFPtr(pc),a1        ;a1=DoorInterface Struct
  61.         moveq    #LF,d1            ;d1=MSG_DATA
  62.         CALL    WriteStr        ;write string to user
  63.  
  64. ;-------------- Show 'who' text
  65.         lea    Who2.txt(pc),a0
  66.         move.l    DIFPtr(pc),a1
  67.         moveq    #LF,d1
  68.         CALL    WriteStr
  69.  
  70. ;-------------- Show 'who' text
  71.         lea    Who3.txt(pc),a0
  72.         move.l    DIFPtr(pc),a1
  73.         moveq    #LF,d1
  74.         CALL    WriteStr
  75.  
  76. ;-------------- call systems 'node' configurations
  77.  
  78.         bsr.s    GetNodeInfo
  79.  
  80. ;-------------- Show 'who' end texts
  81.  
  82.         lea    Done.txt(pc),a0
  83.         move.l    DIFPtr(pc),a1
  84.         moveq    #NOLF,d1
  85.         move.l    _AEDBase(pc),a6
  86.         CALL    WriteStr
  87.  
  88.         lea    Line.txt(pc),a0
  89.         move.l    DIFPtr(pc),a1
  90.         moveq    #NOLF,d1
  91.         move.l    _AEDBase(pc),a6
  92.         CALL    WriteStr
  93.  
  94.         lea    Done2.txt(pc),a0
  95.         move.l    DIFPtr(pc),a1
  96.         moveq    #NOLF,d1
  97.         move.l    _AEDBase(pc),a6
  98.         CALL    WriteStr
  99.  
  100.         lea    Done3.txt(pc),a0
  101.         move.l    DIFPtr(pc),a1
  102.         moveq    #NOLF,d1
  103.         move.l    _AEDBase(pc),a6
  104.         CALL    WriteStr
  105.  
  106. ;-------------- Remove Ami-Door Communiations channel
  107.  
  108. CloseAEComm:    move.l    DIFPtr(pc),a1
  109.         move.l    _AEDBase(pc),a6
  110.         CALL    DeleteComm
  111.  
  112. ;-------------- close DOS Library
  113.  
  114. CloseDOS:    move.l    _DOSBase(pc),a1        ;get DOS library ptr to close
  115.         move.l    4.w,a6            ;get execbase
  116.         CALL    CloseLibrary        ;close the DOS library
  117.  
  118. ;-------------- close AELib
  119.  
  120. CloseAEDoor:    move.l    _AEDBase(pc),a1        ;get library AEDBase to close
  121.         move.l    4.w,a6            ;get execbase
  122.         CALL    CloseLibrary        ;close the AEDoor library
  123. ExitDoor
  124. DDDOne:        rts                ;exit program
  125.  
  126.  
  127. GetNodeInfo:    move.l    #123,d0            ;COMMAND: JH_ACTIVE_NODES
  128.         moveq    #1,d1            ;DATA:    
  129.         move.l    DIFPtr(pc),a1
  130.         move.l    _AEDBase(pc),a6
  131.         CALL    SendDataCmd        ;get active nodes
  132.  
  133.         lea    ActiveNodes(pc),a0    ;a0=destination
  134.         move.l    DIFPtr(pc),a1        ;a1=DIFStruct
  135.         CALL    CopyStr            ;get string from struct
  136.  
  137.         moveq    #-1,d0
  138.         lea    ActiveNodes(pc),a0
  139. getloop:    addq.l    #1,d0
  140.         tst.b    (a0,d0.l)
  141.         beq.s    DDDOne
  142.         cmp.b    #'X',(a0,d0.l)
  143.         bne.s    getloop
  144.  
  145.         movem.l    d0/a0,-(sp)
  146.         bsr.s    FillASCII
  147.  
  148.         lea    node.txt(pc),a0
  149.         move.l    DIFPtr(pc),a1
  150.         moveq    #LF,d1
  151.         move.l    _AEDBase(pc),a6
  152.         CALL    WriteStr
  153.  
  154.         movem.l    (sp)+,d0/a0
  155.  
  156.         bra.s    getloop
  157.  
  158.  
  159. FillASCII:    move.b    d0,(Node.txt-Startup)+5(a5)
  160.         add.b    #'0',(Node.txt-Startup)+5(a5)
  161.         bsr.b    FillFronts
  162.         bsr.w    SortENVStuff
  163.  
  164. DoActivity:    move.l    d0,d1
  165.         cmp.l    #-1,d0
  166.         bne.s    FillInActivity
  167.         lea    LostCarrier.txt(pc),a0
  168.         bra.s    DoAction
  169.  
  170. FillInActivity:    lea    Messages.txt(pc),a0
  171.         mulu    #19,d0            ;19 chars per message
  172.         add.l    d0,a0
  173.  
  174. DoAction:    lea    Action.txt(pc),a1
  175.         move.l    (a0)+,(a1)+    ;4
  176.         move.l    (a0)+,(a1)+    ;8    ;copy all 19 chars for
  177.         move.l    (a0)+,(a1)+    ;12    ;current status action
  178.         move.l    (a0)+,(a1)+    ;16
  179.         move.w    (a0)+,(a1)+    ;18
  180.         move.b    (a0)+,(a1)+    ;19
  181.  
  182.         lea    NodeSpace(pc),a0
  183.         lea    Handle.txt(pc),a1
  184.  
  185.         moveq    #0,d0
  186. CopyHandle:    tst.b    (a0)
  187.         beq.s    GetLocation
  188.         cmp.l    #15,d0
  189.         beq.s    GetLocation
  190.         move.b    (a0)+,(a1)+
  191.         addq.l    #1,d0
  192.         bra.s    CopyHandle
  193.  
  194. GetLocation:    lea    LocationSpace(pc),a0
  195.         lea    Location.txt(pc),a1
  196.         moveq    #0,d0
  197. copyloc:    tst.b    (a0)
  198.         beq.s    locdone
  199.         cmp.l    #25,d0
  200.         beq.s    locdone
  201.         move.b    (a0)+,(a1)+
  202.         addq.l    #1,d0
  203.         bra.s    copyloc
  204. locdone:    rts
  205.  
  206.  
  207. FillFronts:    lea    Handle.txt(pc),a1
  208.         move.l    #'    ',d1
  209.         move.l    d1,(a1)+    ;4
  210.         move.l    d1,(a1)+    ;8
  211.         move.l    d1,(a1)+    ;12
  212.         move.w    d1,(a1)+    ;14
  213.         move.b    d1,(a1)+    ;15
  214.  
  215.         lea    Location.txt(pc),a1
  216.         move.l    d1,(a1)+    ;4
  217.         move.l    d1,(a1)+    ;8
  218.         move.l    d1,(a1)+    ;12
  219.         move.l    d1,(a1)+    ;16
  220.         move.l    d1,(a1)+    ;20
  221.         move.l    d1,(a1)+    ;24
  222.         move.b    d1,(a1)+    ;25
  223.  
  224.         lea    Action.txt(pc),a1
  225.         move.l    d1,(a1)+    ;4
  226.         move.l    d1,(a1)+    ;8
  227.         move.l    d1,(a1)+    ;12
  228.         move.l    d1,(a1)+    ;16
  229.         move.w    d1,(a1)+    ;18
  230.         move.b    d1,(a1)+    ;19
  231.  
  232.         lea    NodeSpace(pc),a1
  233.         moveq    #0,d1
  234.         move.l    d1,(a1)+    ;4
  235.         move.l    d1,(a1)+    ;8
  236.         move.l    d1,(a1)+    ;12
  237.         move.w    d1,(a1)+    ;14
  238.         move.b    d1,(a1)+    ;15
  239.  
  240.         lea    LocationSpace(pc),a1
  241.         move.l    d1,(a1)+    ;4
  242.         move.l    d1,(a1)+    ;8
  243.         move.l    d1,(a1)+    ;12
  244.         move.l    d1,(a1)+    ;16
  245.         move.l    d1,(a1)+    ;20
  246.         move.l    d1,(a1)+    ;24
  247.         move.b    d1,(a1)+    ;25
  248.         rts
  249.  
  250.  
  251. SortENVStuff:    move.b    d0,EnvNode-Startup(a5)
  252.         add.b    #'0',EnvNode-Startup(a5)
  253.         move.b    d0,_NodeFile.txt-Startup(a5)
  254.         add.b    #'0',_NodeFile.txt-Startup(a5)
  255.         bsr.s    _GetNodeFile
  256.         cmp.l    #$FFFFFFFF,d1
  257.         beq.s    ErrorENVFile
  258.         bsr.b    GetENVStats
  259.         cmp.l    #$12,d0
  260.         bne.s    EnvFileErr
  261. _ENVFileErrors:
  262. _NodeFileFailed
  263.         moveq    #-1,d1
  264. EnvFileErr:    rts
  265. ErrorENVFile:    moveq    #$12,d0
  266.         rts
  267.  
  268.  
  269. _GetNodeFile:    lea    _NodeFilename(pc),a0
  270.         move.l    a0,d1
  271.         move.l    #MODE_OLDFILE,d2
  272.         move.l    _DOSBase(pc),a6
  273.         jsr    _LVOOpen(a6)
  274.         move.l    d0,_FileBase1-Startup(a5)
  275.         beq.b    _NodeFileFailed
  276.  
  277.         move.l    d0,d1
  278.         lea    NodeSpace(pc),a0
  279.         move.l    a0,d2
  280.         moveq    #18,d3
  281.         jsr    _LVORead(a6)
  282.         tst.l    d0
  283.         bmi.w    CloseNodeFile
  284.  
  285.         move.l    _FileBase1(pc),d1
  286.         moveq    #40,d2
  287.         moveq    #-1,d3
  288.         jsr    _LVOSeek(a6)
  289.         moveq    #-1,d1
  290.         cmp.l    d1,d0
  291.         beq.s    CloseNodeFile
  292.  
  293.         move.l    _FileBase1(pc),d1
  294.         lea    LocationSpace(pc),a0
  295.         move.l    a0,d2
  296.         moveq    #$1C,d3
  297.         jsr    _LVORead(a6)
  298.         tst.l    d0
  299.         bmi.s    CloseNodeFile
  300.  
  301.         move.l    _FileBase1(pc),d1
  302.         jsr    _LVOClose(a6)
  303.         moveq    #0,d1
  304. Stub:        rts
  305.  
  306.  
  307. GetENVStats:    lea    EnvStats.txt(pc),a0
  308.         move.l    a0,d1
  309.         move.l    #MODE_OLDFILE,d2
  310.         move.l    _DOSBase(pc),a6
  311.         jsr    _LVOOpen(a6)
  312.         move.l    d0,_FileBase1-Startup(a5)
  313.         beq.w    _ENVFileErrors
  314.  
  315.         move.l    d0,d1
  316.         moveq    #$24,d2
  317.         moveq    #-1,d3
  318.         jsr    _LVOSeek(a6)
  319.         moveq    #-1,d1
  320.         cmp.l    d1,d0
  321.         beq.b    _CloseENVFile
  322.  
  323.         move.l    _FileBase1(pc),d1
  324.         lea    _EnvMem(pc),a0
  325.         move.l    a0,d2
  326.         moveq    #2,d3
  327.         jsr    _LVORead(a6)
  328.         tst.l    d0
  329.         bmi.b    _CloseENVFile
  330.  
  331.         lea    _EnvMem(pc),a0
  332.         bsr.s    LookENVStats
  333.  
  334.         move.l    d0,-(sp)
  335.         move.l    _FileBase1(pc),d1
  336.         jsr    _LVOClose(a6)
  337.         move.l    (sp)+,d0
  338. _ExitENVLoad:    rts
  339. _CloseENVFile:
  340. CloseNodeFile:    move.l    _FileBase1(pc),d1
  341.         jsr    _LVOClose(a6)
  342. _failed:    moveq    #-1,d1
  343.         rts
  344.  
  345. LookENVStats:    movem.l    d1-d7/a0-a6,-(sp)
  346.         moveq    #0,d0
  347.         move.l    d0,d1
  348.         move.l    d0,d2
  349.  
  350.         move.b    (a0)+,d2
  351.         cmp.b    #'+',d2
  352.         beq.s    GotPlus
  353.         cmp.b    #'-',d2
  354.         bne.s    GotMinus
  355.         moveq    #1,d1
  356.         bra.s    GotPlus
  357.  
  358. GotMinus:    subq.l    #1,a0
  359. GotPlus:    move.b    (a0)+,d2
  360.         beq.s    GotZero
  361.         and.b    #15,d2
  362.         mulu    #10,d0
  363.         add.l    d2,d0
  364.         bra.s    GotPlus
  365.  
  366. GotZero:    tst.l    d1
  367.         beq.s    DDone
  368.         neg.l    d0
  369. DDone:        movem.l    (sp)+,d1-d7/a0-a6
  370.         rts
  371.  
  372. _DOSBase:    ds.l    1            ;DOS Library base
  373. _AEDBase:    ds.l    1            ;AEDoor Library base
  374. DIFPtr        ds.l    1            ;DIFStructure base
  375. _EnvMem:    ds.l    1
  376. _FileBase1:    ds.l    1
  377. ActiveNodes:    ds.b    10            ;Active nodes storage
  378. NodeSpace:    ds.b    18            ;/X Nodes
  379. LocationSpace:    ds.b    28            ;"Location"
  380.         even
  381. AEName:        AEDOORNAME
  382.         even
  383. DName:        DOSNAME
  384.         even
  385. EnvStats.txt:    dc.b    'ENV:STATS@'
  386. EnvNode:    dc.b    '%',0
  387.  
  388. _NodeFilename:    dc.b    'BBS:node'
  389. _NodeFile.txt:    dc.b    '%','.user',0
  390. Zero:        dc.b    0
  391.         even
  392.  
  393. Who.txt:    dc.b    "                                                                             .",$a
  394.         dc.b    "  .                                                                          :"
  395.         dc.b    0
  396.         even
  397. Who2.txt:    dc.b    "  |             -^- /X sUPER-wHO v1.3 - wRiTTeN bY 2-cOOL/LSd! -^-           |",$a
  398. Line.txt:    dc.b    "--+--------------------------------------------------------------------------+-"
  399.         dc.b    0
  400.         even
  401. Who3.txt:    dc.b    "  |Ø··     -^-hAndLE-^-       -^-LoCATIOn/GroUP-^-        -^-AcTion-^-    ··Ø|",$a
  402.         dc.b    "  |:     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~    :|"
  403.         dc.b    0
  404.         even
  405. Node.txt:    dc.b    '  | [x] | '
  406. Handle.txt:    dc.b    '123456789012345 | '        ;Space for 15 bytes
  407. Location.txt:    dc.b    '1234567890123456789012345 |'    ;Space for 25 bytes
  408. Action.txt:    dc.b    '1234567890123456789 | |',0,0    ;Space for 19 bytes
  409.         even
  410. Done.txt:    dc.b    "  |:    `------------------------------------------------------------------'.|",$a
  411.         dc.b    "  |Ø··   -¿- Written exclusively for SkullBuggery - !The BrOtHa-HoOd! -¿- ..:|"
  412.         dc.b    $a,0
  413.         even
  414. Done2.txt:    dc.b    $a,"  |                                                                          |"
  415.         dc.b    0
  416.         even
  417. Done3.txt:    dc.b    $a,"  |                                                                          .",$a
  418.         dc.b    "  :",$a
  419.         dc.b    "  .",$a,0
  420.         even
  421.  
  422. LostCarrier.txt    dc.b    '- !lOST cARRIER! - ',0
  423. Messages.txt:    dc.b    'nOTHING iNTERESTING'
  424.         dc.b    ' DL: xxxxxxxx.xxx! '
  425.         dc.b    ' UL: xxxxxxxx.xxx! '
  426.         dc.b    '- uSING A /X dOOR -'
  427.         dc.b    ' - rEADING mAIL! - '
  428.         dc.b    '- cHECKING sTATUS -'
  429.         dc.b    '- aCCOUNT eDITING -'
  430.         dc.b    ' - zOOMiNG mAIL! - '
  431.         dc.b    '- sCANNING fILES! -'
  432.         DC.B    ' vIEWING bULLETINS '
  433.         DC.B    '- vIEWING a fILE  -'
  434.         DC.B    '- tRYING tO lOGON -'
  435.         DC.B    ' - lOGGING oFF! -  '
  436.         DC.B    '- sYSOP fUNCTIONS -'
  437.         DC.B    '- rEMOTE sHELL!!! -'
  438.         DC.B    '-   uSING eMACS   -'
  439.         DC.B    'jOINING cONFERENCE '
  440.         DC.B    'cHATTING wITH sYSOP'
  441.         DC.B    '- aWAITING lOGON - ',0
  442.         end
  443.